package com.qiaofang.applet.service.other.domain;

import com.qiaofang.applet.common.base.BaseDomain;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.LinkedList;
import java.util.List;

/**
 * Created by IDEA.
 *
 * @auther Zym.
 * @company qiaofang
 * @date 2020/9/11 15:21
 */
@Data
@Document(collection = "other_city_company")
@ApiModel("城市公司表")
@NoArgsConstructor
@AllArgsConstructor
public class CityCompany extends BaseDomain {

    @ApiModelProperty(value = "公司名称")
    private String companyName;

    @ApiModelProperty(value = "城市名称")
    private String companyCity;

    @ApiModelProperty(value = "启用状态,1 启动 0 停用")
    private Integer status;

    @ApiModelProperty(value = "默认标识：0 非默认|1 默认")
    private Integer defaultFlag;

    @ApiModelProperty(value = "初始化标识")
    private Boolean initFlag;

    @ApiModelProperty(value = "首页logo图")
    private String indexLogoImg;

    @ApiModelProperty(value = "公司logo图")
    private String companyLogoImg;

    @ApiModelProperty(value = "公司标语")
    private String slogan;

    @ApiModelProperty(value = "公司介绍")
    private String introduction;

    @ApiModelProperty("交易进度查询URL")
    private String txh5Url;

    @ApiModelProperty("二手房、租房经纪人展示规则")
    private EmpShowRules propertyShowRules;

    @ApiModelProperty("新房经纪人展示规则")
    private EmpShowRules firsthandShowRules;

    @ApiModelProperty(value = "主城市库标识 1 是 0 否")
    private Integer mainCityFlag;

    @ApiModelProperty(value = "城市子域名")
    private String subWebDomain;

    @ApiModelProperty("房源图片水印设置")
    private PropertyWaterMark propertyWaterMark;

    @ApiModelProperty("安居客城市ID")
    private Long universeCityId;

    public EmpShowRules getPropertyShowRules() {
        if (propertyShowRules == null) {
            propertyShowRules = new EmpShowRules();
            propertyShowRules.setShowStrategy(1);
            propertyShowRules.setRoleList(new LinkedList<>());
            propertyShowRules.setAssignRule(new AssignRule(1, 5));
        }
        return propertyShowRules;
    }

    public EmpShowRules getFirsthandShowRules() {
        if (firsthandShowRules == null) {
            firsthandShowRules = new EmpShowRules();
            List<PropertyRole> list = new LinkedList<>();
            list.add(PropertyRole.builder().roleId(-1L).roleName("楼盘维护人1").showOrHide(true).fixedShow(true).build());
            list.add(PropertyRole.builder().roleId(-2L).roleName("楼盘维护人2").showOrHide(true).fixedShow(false).build());
            list.add(PropertyRole.builder().roleId(-3L).roleName("楼盘维护人3").showOrHide(true).fixedShow(false).build());
            firsthandShowRules.setShowStrategy(1);
            firsthandShowRules.setRoleList(list);
            firsthandShowRules.setAssignRule(new AssignRule(1, 5));
        }
        return firsthandShowRules;
    }
}
